import $http from '@/common/api/request.js'

// 留言反馈
export function addFeedback(data) {
  return $http.post('/user/feedback/add', data, {
    header: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    noCheck: true
  })
}

// 车企账单列表查询
export const getVehicleCompanyBillList = (params) => {
  return $http.get('/user/portal/auto/company/bill/page', params)
}

// 车企账单汇总查询
export const getSumCompanyBill = (params) => {
  return $http.get('/user/portal/auto/company/bill/sumCompanyBill', params)
}

// 通过ID获取车企账单详情
export const getVehicleCompanyBillOne = (id, data) => {
  return $http.get('/user/portal/auto/company/bill/detail/' + id, data)
}

// 查询账单结算订单
export const searchBillOrderUserInfo = (params) => {
  return $http.get('/user/portal/auto/company/bill/pageOrder', params)
}

// 挂账列表查询
export function pageCreditManagement(params) {
  return $http.get('/order/portal/creditManagement/pageCreditManagement', params)
}

// 用户历史账单
export function pageHistoricalBill(params) {
  return $http.get('/order/portal/creditManagement/pageHistoricalBill', params)
}

// 获取用户账单汇总
export function getOneCreditManagement(params) {
  return $http.get('/order/portal/creditManagement/getOneCreditManagement', params)
}

// 新增收款明细
export function addCollectionDetails(data) {
  return $http.post('/order/portal/creditManagement/addCollectionDetails', data, {
    header: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// 判断车企是否可以注销
export function cancellationJudgment() {
  return $http.get('/user/user/cancellationJudgment')
}

// 查询企业/车企子账号
export function getSubAccount(userId, data) {
  return $http.get('/user/subAccount/user/' + userId, data)
}

// 删除企业/车企子账号
export function deleteSubAccount(userId, data) {
  return $http.post('/user/subAccount/delete/' + userId, data)
}

// 获取权限列表
export function fetchList(data) {
  return $http.get('/user/role/rolePage', data)
}

// 新增企业/车企子账号
export function addSubAccount(data) {
  return $http.post('/user/user/v2/addAutoCompanySubAccount', data)
}

// 编辑企业/车企子账号
export function update(data) {
  return $http.post('/user/subAccount/update', data)
}

// 分页获取客户单位
export function pageCompany(data) {
  return $http.get('/user/autoCompany/customer/pageCompany', data)
}

// 添加客户
export function addCustomer(data) {
  return $http.post('/user/autoCompany/customer/add', data, {
    header: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// 编辑客户
export function editCustomer(data) {
  return $http.post('/user/autoCompany/customer/update', data, {
    header: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// 删除客户
export function delCustomer(data) {
  return $http.post('/user/autoCompany/customer/del', data)
}

// 获取挂账信息汇总
export function sumCreditManagement() {
  return $http.get('/order/portal/creditManagement/sumCreditManagement')
}
export function deprecated(){
	return $http.get('/order/portal/creditManagement/sumCreditManagement/Deprecated')
}
// 获取会员权限列表
export function getAllTree(data) {
  return $http.get('/user/menu/getAllTree', data)
}

// 预获取会员订单
export function getVIPPayOrderDetail(data) {
  return $http.post('/order/order/getVIPPayOrderDetail', data)
}

// 获取支付openid
export function getWxspSessionKey(data) {
  return $http.get('/auth/user/v2/wx/getOpenId', data, {
    noCheck: true
  })
}

// 创建购买会员订单
export function createVIPPayOrder(data) {
  return $http.post('/order/order/createVIPPayOrder', data, {
    header: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// 收款明细列表
export function pageCollectionDetails(params) {
  return $http.get('/order/portal/creditManagement/pageCollectionDetails', params)
}

// 收款明细详情
export function getOneHistoricalBill(params) {
  return $http.get('/order/portal/creditManagement/getOneHistoricalBill', params)
}

// 编辑收款明细
export function updateCollectionDetails(data) {
  return $http.post('/order/portal/creditManagement/updateCollectionDetails', data, {
    header: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// 用户订单
export function pageOrder(params) {
  return $http.get('/order/portal/creditManagement/pageOrder', params)
}

// 查询获客需求单列表
export function getCompanyHookList(data) {
  return $http.get('/order/portal/companyHookOrder/page', data)
}

// 删除挂账订单
export function delCollectionDetails(id) {
  return $http.del('/order/portal/creditManagement/delCollectionDetails/' + id)
}
